<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/code/image', 'CodeController@image');

Route::group(['prefix' => 'admin'], function()
{
    Route::any('/login', 'Admin\LoginController@index');

    Route::group(['middleware' => 'checkLogin'], function()
    {
        Route::get('index', 'Admin\IndexController@index');
        Route::get('/logout', 'Admin\IndexController@logout');
        Route::get('/index/console', 'Admin\IndexController@console');
        Route::get('/index/form', 'Admin\IndexController@form');
        Route::get('/index/list', 'Admin\IndexController@table');

        Route::get('/menu', 'Admin\MenuController@index');
        Route::any('/menu/create', 'Admin\MenuController@create');
        Route::any('/menu/edit/{id}', 'Admin\MenuController@edit');
        Route::any('/menu/destroy', 'Admin\MenuController@destroy');
        Route::any('/menu/changeStatus', 'Admin\MenuController@changeStatus');
        Route::any('/menu/changeSort', 'Admin\MenuController@changeSort');

        Route::any('/auth', 'Admin\AuthController@index');
        Route::any('/auth/create', 'Admin\AuthController@create');
        Route::any('/auth/edit/{id}', 'Admin\AuthController@edit');
        Route::any('/auth/destroy', 'Admin\AuthController@destroy');

        Route::any('/role', 'Admin\RoleController@index');
        Route::any('/role/create', 'Admin\RoleController@create');
        Route::any('/role/edit/{id}', 'Admin\RoleController@edit');
        Route::any('/role/destroy', 'Admin\RoleController@destroy');

        Route::any('/adminUser', 'Admin\AdminUserController@index');
        Route::any('/adminUser/create', 'Admin\AdminUserController@create');
        Route::any('/adminUser/edit/{id}', 'Admin\AdminUserController@edit');
        Route::any('/adminUser/destroy', 'Admin\AdminUserController@destroy');
        Route::any('/adminUser/changeStatus', 'Admin\AdminUserController@changeStatus');
        Route::any('/adminUser/resetPsd', 'Admin\AdminUserController@resetPsd');
        Route::any('/adminUser/groupAuth/{uid}', 'Admin\AdminUserController@groupAuth');

        Route::any('/businessLog', 'Admin\BusinessLogController@index');

    });
});